<?php

declare(strict_types=1);

namespace App\Controller;

use App\Constants\ErrorCode;
use App\Service\FlyShopFansService;
use Hyperf\Validation\Rule;
use Psr\Http\Message\ServerRequestInterface;
use Hyperf\Di\Annotation\Inject;
use Hyperf\DbConnection\Db;

class FansController extends AbstractController
{

    /**
     * @Inject
     * @var FlyShopFansService
     */
    private $fans;

    public function index()
    {

    }
    public function shop_fans_num()
    {
        $shop_id = $this->request->input('shop_id',0);
        if(!$shop_id){
            return $this->jsonResponse->error(ErrorCode::SYSTEM_INVALID,'缺少参数shop_id');
        }
      return $this->jsonResponse->success($this->fans->getShopFans(intval($shop_id)),'粉丝数量');
    }
    public function list()
    {
        $shop_id = $this->request->input('shop_id',0);
        if(!$shop_id){
            return $this->jsonResponse->error(ErrorCode::SYSTEM_INVALID,'缺少参数shop_id');

        }
        return $this->jsonResponse->success($this->paginate($this->fans->getShopFans(intval($shop_id),2)),'粉丝列表');
    }

}
